package flipAndInvertImage;

public class Solution {
    public int[][] flipAndInvertImage(int[][] image) {
//        for (int i = 0; i < image.length; i++) {
//            int l = 0;
//            int r = image.length-1;
//            while(l<r){
//                image[i][l++] = image[i][r--];
//            }
//        }
//        for (int i = 0; i < image.length; i++) {
//            for (int j = 0; j < image.length; j++) {
//                image[i][j] = image[i][j]==1?0:1;
//            }
//        }
//        return image;
        int[][] ans = new int[image.length][image[0].length];
        for (int i = 0; i < image.length; i++) {
            for (int j = 0; j < image[0].length; j++) {
                ans[i][j] = image[i][image[i].length-j-1]==1?0:1;
            }
        }
        return ans;
    }
}
